﻿<div style="width: 100%;">
    <div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
        <table style="width: 100%;">
            <tr>
                <td style="width: 10%;">
                    <a class="mini-button" style="width: 60px; padding-left: 10px;" plain="true" onclick="ok()" iconcls="icon-save">确定</a>
                </td>
                <td style="width: 90%; text-align: right">
                    <input id="namekey" class="mini-textbox" emptytext="输入层级树名称" style="width: 150px;" onenter="onKeyEnter" />
                    <a class="mini-button" iconcls="icon-search" tooltip="搜索" plain="true" onclick="search()"></a>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="mini-fit">
    <div id="grid" class="mini-datagrid" style="width: 100%; height: 100%;" showpager="false" allowcellvalid="true"
        allowresize="false" pagesize="9999999" allowcelledit="true" allowcellselect="true" multiselect="true"
        url="/SystemData/HierarchyTree/GetAllHierarchyTreeRoot" showemptytextt="true" emptytext="无纪录">
        <div property="columns">
            <div type="checkcolumn"></div>
            <div field="DKey" width="80" headeralign="center" allowsort="true">
                层级树编码
            </div>
            <div field="DKeyName" width="120" headeralign="center" allowsort="true">
                层级树名称
            </div>
            <div field="DNote" width="180" headeralign="center">
                层级树描述
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    mini.parse();

    var grid = mini.get("grid");
    grid.load();
    function onKeyEnter() {
        search();
    }

    function search() {
        var key = "[{'query':'" + mini.get("namekey").getValue() + "'}]";
        grid.load({ key: key });
    }

    function ok() {
        var row = grid.getSelecteds();
        if (row.length == 0) {
            alert("请选择一条记录");
            return;
        } else {
            closeWindow("ok");
        }
    }

    function getSelectedRows() {
        var row = grid.getSelecteds();
        return row;
    }

    function closeWindow(action) {
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }

</script>
